import { defineComponent as D, toRefs as L, computed as V, resolveComponent as O, openBlock as d, createElementBlock as r, createElementVNode as U, createVNode as t, unref as l, withCtx as u, createTextVNode as M, Fragment as m, renderList as s, createBlock as b, createCommentVNode as f } from "vue";
import { b as z, B as Y, C as o, j as _, k as p, e as c } from "./vendor.CF2kwqqq.js";
const q = { class: "flex justify-end" }, A = { class: "mt-8" }, P = /* @__PURE__ */ D({
  __name: "editRule",
  props: {
    formData: { default: () => ({}) },
    type: {},
    preview: {}
  },
  setup(H) {
    const w = H, { formData: y, type: i } = L(w), h = V(() => (y.value.outFields || []).map((n) => ({
      name: n.name,
      in_stream_name: n.name,
      type: n.type
    }))), x = V(() => (y.value.outFields || []).map((n) => ({
      name: n.name,
      in_stream_name: n.name,
      type: n.type
    }))), C = V(() => (y.value.outFields || []).map((n) => ({
      name: n.name
    }))), E = V(() => (y.value.outFields || []).map((n) => ({
      name: n.name
    }))), S = V(() => (y.value.outFields || []).map((n) => ({
      name: n.name
    }))), F = [
      {
        key: "yes",
        label: "是"
      },
      {
        key: "no",
        label: "否"
      }
    ], X = [
      {
        key: "yes",
        label: "是"
      },
      {
        key: "no",
        label: "否"
      }
    ], k = [
      {
        key: "Y",
        label: "是"
      },
      {
        key: "N",
        label: "否"
      }
    ], N = [
      {
        key: "yes",
        label: "是"
      },
      {
        key: "no",
        label: "否"
      }
    ], B = [
      {
        key: "yes",
        label: "是"
      },
      {
        key: "no",
        label: "否"
      }
    ], R = [
      "yyyy/MM/dd HH:mm:ss.Sss",
      "yyyy/MM/dd HH:mm:ss.SSS xxx",
      "yyyy/MM/dd HH:mm:ss",
      "yyyy/MM/dd HH:mm:ss XXx",
      "yyyyMMddHHmmss",
      "yyyy/MM/dd",
      "yyyy-MM-dd",
      "yyyy-MM-dd HH:mm:ss",
      "yyyy-MM-dd HH:mm:ss XXx",
      "yyyyMMdd",
      "MM/dd/yyyyMM/ddlyyyy HH:mm:ss",
      "MM-dd-yyyy",
      "MM-dd-yyyy HH:mm:ss",
      "MM/dd/yy",
      "MM-dd-yy",
      "dd/MM/yyyy",
      "dd-MM-yyyy",
      "xy-MM.-dd",
      "HH:mm:ss.SSSXXX",
      "wy-MIM-da HH:mm:ss.sss"
    ], I = () => i.value == 2 ? {
      name: "",
      type: "",
      format: "",
      trim_type: "",
      length: -1,
      precision: -1,
      money: "",
      point: "",
      group: ""
    } : i.value == 3 ? {
      name: "",
      value: "",
      mask: "",
      set_empty_string: ""
    } : i.value == 4 ? {
      source_value: "",
      target_value: ""
    } : {
      use_regex: "",
      replace_string: "",
      //搜索
      in_stream_name: "",
      out_stream_name: "",
      replace_by_string: "",
      //替换
      type: "",
      format: "",
      trim_type: "",
      length: -1,
      replace_field_by_string: "",
      precision: -1,
      currency: "",
      point: "",
      group: ""
    };
    function T() {
      var n;
      (n = y.value) == null || n.fields.field.push(I());
    }
    function $(n) {
      y.value.fields.field.splice(n, 1);
    }
    function g(n) {
      h.value.forEach((v) => {
        v.in_stream_name === n.in_stream_name && (n.type = v.type, n.name = v.name);
      });
    }
    return (n, v) => {
      const j = O("el-form");
      return d(), r("div", null, [
        U("div", q, [
          t(l(z), {
            type: "primary",
            onClick: T
          }, {
            default: u(() => [
              M("新增")
            ]),
            _: 1
          })
        ]),
        U("div", A, [
          t(j, {
            model: l(y),
            ref: "form",
            "label-width": "180px",
            size: "small"
          }, {
            default: u(() => [
              t(l(Y), {
                data: l(y).fields.field,
                border: "",
                height: "250",
                "header-cell-style": { background: "#eef1f6" }
              }, {
                default: u(() => [
                  t(l(o), {
                    type: "index",
                    label: "#"
                  }),
                  l(i) == 0 ? (d(), r(m, { key: 0 }, [
                    t(l(o), {
                      prop: "in_stream_name",
                      label: "输入流字段",
                      width: "160"
                    }, {
                      default: u(({ row: a }) => [
                        t(l(_), {
                          modelValue: a.in_stream_name,
                          "onUpdate:modelValue": (e) => a.in_stream_name = e,
                          size: "small",
                          filterable: "",
                          "allow-create": "",
                          clearable: "",
                          placeholder: "请选择",
                          onChange: (e) => g(a)
                        }, {
                          default: u(() => [
                            (d(!0), r(m, null, s(h.value, (e) => (d(), b(l(p), {
                              key: e.name,
                              label: e.in_stream_name,
                              value: e.in_stream_name
                            }, null, 8, ["label", "value"]))), 128))
                          ]),
                          _: 2
                        }, 1032, ["modelValue", "onUpdate:modelValue", "onChange"])
                      ]),
                      _: 1
                    }),
                    t(l(o), {
                      prop: "out_stream_name",
                      label: "输出流字段",
                      width: "160"
                    }, {
                      default: u(({ row: a }) => [
                        t(l(c), {
                          modelValue: a.out_stream_name,
                          "onUpdate:modelValue": (e) => a.out_stream_name = e,
                          size: "small",
                          clearable: ""
                        }, null, 8, ["modelValue", "onUpdate:modelValue"])
                      ]),
                      _: 1
                    }),
                    t(l(o), {
                      prop: "use_regex",
                      label: "使用正则表达式",
                      width: "150"
                    }, {
                      default: u(({ row: a }) => [
                        t(l(_), {
                          modelValue: a.use_regexs,
                          "onUpdate:modelValue": (e) => a.use_regexs = e,
                          size: "small",
                          style: { width: "100%" },
                          placeholder: "请选择",
                          clearable: ""
                        }, {
                          default: u(() => [
                            (d(), r(m, null, s(X, (e) => t(l(p), {
                              key: e.key,
                              label: e.label,
                              value: e.key
                            }, null, 8, ["label", "value"])), 64))
                          ]),
                          _: 2
                        }, 1032, ["modelValue", "onUpdate:modelValue"])
                      ]),
                      _: 1
                    }),
                    t(l(o), {
                      prop: "replace_by_string",
                      label: "搜索",
                      width: "140"
                    }, {
                      default: u(({ row: a }) => [
                        t(l(c), {
                          modelValue: a.replace_string,
                          "onUpdate:modelValue": (e) => a.replace_string = e,
                          size: "small"
                        }, null, 8, ["modelValue", "onUpdate:modelValue"])
                      ]),
                      _: 1
                    }),
                    t(l(o), {
                      prop: "replace_by_string",
                      label: "使用...替换",
                      width: "140"
                    }, {
                      default: u(({ row: a }) => [
                        t(l(c), {
                          modelValue: a.replace_by_string,
                          "onUpdate:modelValue": (e) => a.replace_by_string = e,
                          size: "small"
                        }, null, 8, ["modelValue", "onUpdate:modelValue"])
                      ]),
                      _: 1
                    }),
                    t(l(o), {
                      prop: "set_empty_string",
                      label: "设置为空串?",
                      width: "120"
                    }, {
                      default: u(({ row: a }) => [
                        t(l(_), {
                          modelValue: a.set_empty_string,
                          "onUpdate:modelValue": (e) => a.set_empty_string = e,
                          size: "small",
                          style: { width: "100%" },
                          placeholder: "请选择",
                          clearable: ""
                        }, {
                          default: u(() => [
                            (d(), r(m, null, s(k, (e) => t(l(p), {
                              key: e.key,
                              label: e.label,
                              value: e.key
                            }, null, 8, ["label", "value"])), 64))
                          ]),
                          _: 2
                        }, 1032, ["modelValue", "onUpdate:modelValue"])
                      ]),
                      _: 1
                    }),
                    t(l(o), {
                      prop: "replace_field_by_string",
                      label: "使用字段值替换",
                      width: "160"
                    }, {
                      default: u(({ row: a }) => [
                        t(l(_), {
                          modelValue: a.replace_field_by_string,
                          "onUpdate:modelValue": (e) => a.replace_field_by_string = e,
                          size: "small",
                          style: { width: "100%" },
                          placeholder: "请选择",
                          clearable: ""
                        }, {
                          default: u(() => [
                            (d(!0), r(m, null, s(x.value, (e) => (d(), b(l(p), {
                              key: e.name,
                              label: e.in_stream_name,
                              value: e.in_stream_name
                            }, null, 8, ["label", "value"]))), 128))
                          ]),
                          _: 2
                        }, 1032, ["modelValue", "onUpdate:modelValue"])
                      ]),
                      _: 1
                    }),
                    t(l(o), {
                      prop: "whole_word",
                      label: "整个单词匹配",
                      width: "120"
                    }, {
                      default: u(({ row: a }) => [
                        t(l(_), {
                          modelValue: a.whole_word,
                          "onUpdate:modelValue": (e) => a.whole_word = e,
                          size: "small",
                          style: { width: "100%" },
                          placeholder: "请选择",
                          clearable: ""
                        }, {
                          default: u(() => [
                            (d(), r(m, null, s(N, (e) => t(l(p), {
                              key: e.key,
                              label: e.label,
                              value: e.key
                            }, null, 8, ["label", "value"])), 64))
                          ]),
                          _: 2
                        }, 1032, ["modelValue", "onUpdate:modelValue"])
                      ]),
                      _: 1
                    }),
                    t(l(o), {
                      prop: "case_sensitive",
                      label: "大小写敏感",
                      width: "120"
                    }, {
                      default: u(({ row: a }) => [
                        t(l(_), {
                          modelValue: a.case_sensitive,
                          "onUpdate:modelValue": (e) => a.case_sensitive = e,
                          size: "small",
                          style: { width: "100%" },
                          placeholder: "请选择",
                          clearable: ""
                        }, {
                          default: u(() => [
                            (d(), r(m, null, s(F, (e) => t(l(p), {
                              key: e.key,
                              label: e.label,
                              value: e.key
                            }, null, 8, ["label", "value"])), 64))
                          ]),
                          _: 2
                        }, 1032, ["modelValue", "onUpdate:modelValue"])
                      ]),
                      _: 1
                    }),
                    t(l(o), {
                      prop: "is_unicode",
                      label: "是 Unicode",
                      width: "120"
                    }, {
                      default: u(({ row: a }) => [
                        t(l(_), {
                          modelValue: a.is_unicode,
                          "onUpdate:modelValue": (e) => a.is_unicode = e,
                          size: "small",
                          style: { width: "100%" },
                          placeholder: "请选择",
                          clearable: ""
                        }, {
                          default: u(() => [
                            (d(), r(m, null, s(B, (e) => t(l(p), {
                              key: e.key,
                              label: e.label,
                              value: e.key
                            }, null, 8, ["label", "value"])), 64))
                          ]),
                          _: 2
                        }, 1032, ["modelValue", "onUpdate:modelValue"])
                      ]),
                      _: 1
                    })
                  ], 64)) : f("", !0),
                  l(i) == 1 ? (d(), r(m, { key: 1 }, [
                    t(l(o), {
                      prop: "in_stream_name",
                      label: "输入流字段",
                      width: "160"
                    }, {
                      default: u(({ row: a }) => [
                        t(l(_), {
                          modelValue: a.in_stream_name,
                          "onUpdate:modelValue": (e) => a.in_stream_name = e,
                          size: "small",
                          filterable: "",
                          "allow-create": "",
                          clearable: "",
                          placeholder: "请选择",
                          onChange: (e) => g(a)
                        }, {
                          default: u(() => [
                            (d(!0), r(m, null, s(h.value, (e) => (d(), b(l(p), {
                              key: e.name,
                              label: e.in_stream_name,
                              value: e.in_stream_name
                            }, null, 8, ["label", "value"]))), 128))
                          ]),
                          _: 2
                        }, 1032, ["modelValue", "onUpdate:modelValue", "onChange"])
                      ]),
                      _: 1
                    }),
                    t(l(o), {
                      prop: "cut_from",
                      label: "起始位置"
                    }, {
                      default: u(({ row: a }) => [
                        t(l(c), {
                          modelValue: a.cut_from,
                          "onUpdate:modelValue": (e) => a.cut_from = e,
                          size: "small"
                        }, null, 8, ["modelValue", "onUpdate:modelValue"])
                      ]),
                      _: 1
                    }),
                    t(l(o), {
                      prop: "cut_to",
                      label: "结束位置"
                    }, {
                      default: u(({ row: a }) => [
                        t(l(c), {
                          modelValue: a.cut_to,
                          "onUpdate:modelValue": (e) => a.cut_to = e,
                          size: "small"
                        }, null, 8, ["modelValue", "onUpdate:modelValue"])
                      ]),
                      _: 1
                    })
                  ], 64)) : f("", !0),
                  l(i) == 2 ? (d(), r(m, { key: 2 }, [
                    t(l(o), {
                      prop: "name",
                      label: "名称",
                      width: "160"
                    }, {
                      default: u(({ row: a }) => [
                        t(l(_), {
                          modelValue: a.name,
                          "onUpdate:modelValue": (e) => a.name = e,
                          size: "small",
                          filterable: "",
                          "allow-create": "",
                          clearable: "",
                          placeholder: "请选择"
                        }, {
                          default: u(() => [
                            (d(!0), r(m, null, s(C.value, (e) => (d(), b(l(p), {
                              key: e.name,
                              label: e.name,
                              value: e.name
                            }, null, 8, ["label", "value"]))), 128))
                          ]),
                          _: 2
                        }, 1032, ["modelValue", "onUpdate:modelValue"])
                      ]),
                      _: 1
                    }),
                    t(l(o), {
                      prop: "replaceby",
                      label: "替换为字段中的值",
                      width: "160"
                    }, {
                      default: u(({ row: a }) => [
                        t(l(_), {
                          modelValue: a.replaceby,
                          "onUpdate:modelValue": (e) => a.replaceby = e,
                          size: "small",
                          filterable: "",
                          "allow-create": "",
                          clearable: "",
                          placeholder: "请选择"
                        }, {
                          default: u(() => [
                            (d(!0), r(m, null, s(E.value, (e) => (d(), b(l(p), {
                              key: e.name,
                              label: e.name,
                              value: e.name
                            }, null, 8, ["label", "value"]))), 128))
                          ]),
                          _: 2
                        }, 1032, ["modelValue", "onUpdate:modelValue"])
                      ]),
                      _: 1
                    })
                  ], 64)) : f("", !0),
                  l(i) == 3 ? (d(), r(m, { key: 3 }, [
                    t(l(o), {
                      prop: "name",
                      label: "字段",
                      width: "160"
                    }, {
                      default: u(({ row: a }) => [
                        t(l(_), {
                          modelValue: a.name,
                          "onUpdate:modelValue": (e) => a.name = e,
                          size: "small",
                          filterable: "",
                          "allow-create": "",
                          clearable: "",
                          placeholder: "请选择"
                        }, {
                          default: u(() => [
                            (d(!0), r(m, null, s(S.value, (e) => (d(), b(l(p), {
                              key: e.name,
                              label: e.name,
                              value: e.name
                            }, null, 8, ["label", "value"]))), 128))
                          ]),
                          _: 2
                        }, 1032, ["modelValue", "onUpdate:modelValue"])
                      ]),
                      _: 1
                    }),
                    t(l(o), {
                      prop: "value",
                      label: "值替换"
                    }, {
                      default: u(({ row: a }) => [
                        t(l(c), {
                          modelValue: a.value,
                          "onUpdate:modelValue": (e) => a.value = e,
                          size: "small"
                        }, null, 8, ["modelValue", "onUpdate:modelValue"])
                      ]),
                      _: 1
                    }),
                    t(l(o), {
                      prop: "mask",
                      label: "转换掩码(对日期类型)",
                      width: "160"
                    }, {
                      default: u(({ row: a }) => [
                        t(l(_), {
                          modelValue: a.mask,
                          "onUpdate:modelValue": (e) => a.mask = e,
                          size: "small",
                          filterable: "",
                          "allow-create": "",
                          clearable: "",
                          placeholder: "请选择"
                        }, {
                          default: u(() => [
                            (d(), r(m, null, s(R, (e) => t(l(p), {
                              key: e,
                              label: e,
                              value: e
                            }, null, 8, ["label", "value"])), 64))
                          ]),
                          _: 2
                        }, 1032, ["modelValue", "onUpdate:modelValue"])
                      ]),
                      _: 1
                    }),
                    t(l(o), {
                      prop: "set_empty_string",
                      label: "设置为空串?",
                      width: "120"
                    }, {
                      default: u(({ row: a }) => [
                        t(l(_), {
                          modelValue: a.set_empty_string,
                          "onUpdate:modelValue": (e) => a.set_empty_string = e,
                          size: "small",
                          style: { width: "100%" },
                          placeholder: "请选择",
                          clearable: ""
                        }, {
                          default: u(() => [
                            (d(), r(m, null, s(k, (e) => t(l(p), {
                              key: e.key,
                              label: e.label,
                              value: e.key
                            }, null, 8, ["label", "value"])), 64))
                          ]),
                          _: 2
                        }, 1032, ["modelValue", "onUpdate:modelValue"])
                      ]),
                      _: 1
                    })
                  ], 64)) : f("", !0),
                  l(i) == 4 ? (d(), r(m, { key: 4 }, [
                    t(l(o), {
                      prop: "source_value",
                      label: "源值"
                    }, {
                      default: u(({ row: a }) => [
                        t(l(c), {
                          modelValue: a.source_value,
                          "onUpdate:modelValue": (e) => a.source_value = e,
                          size: "small",
                          clearable: ""
                        }, null, 8, ["modelValue", "onUpdate:modelValue"])
                      ]),
                      _: 1
                    }),
                    t(l(o), {
                      prop: "target_value",
                      label: "目标值"
                    }, {
                      default: u(({ row: a }) => [
                        t(l(c), {
                          modelValue: a.target_value,
                          "onUpdate:modelValue": (e) => a.target_value = e,
                          size: "small",
                          clearable: ""
                        }, null, 8, ["modelValue", "onUpdate:modelValue"])
                      ]),
                      _: 1
                    })
                  ], 64)) : f("", !0),
                  t(l(o), {
                    label: "操作",
                    width: "100",
                    fixed: "right"
                  }, {
                    default: u(({ row: a, $index: e }) => [
                      t(l(z), {
                        link: "",
                        type: "primary",
                        onClick: (G) => $(e)
                      }, {
                        default: u(() => [
                          M("删除")
                        ]),
                        _: 2
                      }, 1032, ["onClick"])
                    ]),
                    _: 1
                  })
                ]),
                _: 1
              }, 8, ["data"])
            ]),
            _: 1
          }, 8, ["model"])
        ])
      ]);
    };
  }
});
export {
  P as _
};
